package com.wonders.hisdoctor.station.project.hisqueue.mapper;

import com.wonders.hisdoctor.station.project.base.domain.ClinicMaster;
import com.wonders.hisdoctor.station.project.base.domain.OutpWaitQueue;
import com.wonders.hisdoctor.station.project.hisqueue.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 就诊队列mapper
 *
 * @author zhanghaonan
 * @date 2021/01/20
 */
@Mapper
@Repository
public interface HisQueueMapper {

    /**
     * 查询病人信息
     *
     * @param requestVo
     * @return
     */
    PatientInfoResponseVo selectPatientInfo(PatientInfoRequestVo requestVo);

    /**
     * 更新就诊状态为在诊
     *
     * @param requestVo
     * @return
     */
    int updateRegStatus(PatientInfoRequestVo requestVo);

    /**
     * 科室下拉框
     *
     * @param empNo
     * @param hospitalCode
     * @return
     */
    List<DeptVo> selectDeptByEmpNo(@Param("empNo") String empNo, @Param("hospitalCode") String hospitalCode);

    /**
     * 查询就诊队列
     *
     * @param requestVo
     * @return
     */
    List<ClinicMasterQueueVo> selectWaitQueue(WaitQueueRequestVo requestVo);

    /**
     * 号别下拉框
     *
     * @param vo
     * @return
     */
    List<ClinicIndexVo> selectClinicIndex(ClinicIndexVo vo);

    /**
     * 查询病人就诊记录
     *
     * @param patientId
     * @return
     */
    List<ClinicMasterQueryVo> selectClinicMaster(@Param("patientId") String patientId, @Param("hospitalCode") String hospitalCode);

    /**
     * 完成就诊
     *
     * @param requestVo
     * @return
     */
    int finishVisit(PatientInfoRequestVo requestVo);

    /**
     * 取消就诊
     *
     * @param requestVo
     * @return
     */
    int cancelVisit(PatientInfoRequestVo requestVo);

    /**
     * 查询当前队列是否是已诊状态
     *
     * @param requestVo
     * @return
     */
    OutpWaitQueue selectCancelVisit(PatientInfoRequestVo requestVo);

    /**
     * 查询各状态病人总数
     *
     * @param requestVo
     * @return
     */
    int selectCountByStatus(WaitQueueRequestVo requestVo);

    /**
     * 号类下拉框
     *
     * @param vo
     * @return
     */
    List<ClinicIndexVo> selectClinicType(ClinicIndexVo vo);

    /**
     * 查询就诊队列(根据号类)
     *
     * @param requestVo
     * @return
     */
    List<ClinicMasterQueueVo> selectQueueByClinicType(WaitQueueRequestVo requestVo);

    /**
     * 查询各状态病人总数
     *
     * @param requestVo
     * @return
     */
    int selectCountByClinicType(WaitQueueRequestVo requestVo);

    /**
     * 更新就诊记录表挂号状态
     *
     * @param requestVo
     * @return
     */
    int updateClinicMaster(PatientInfoRequestVo requestVo);
}
